/**
 * 一个加载的封装
 * 基于layer
 */
// loading 效果
// import layer from 'layer'
const Loading = function () {
  this.loadingId = null;
  this.loadingMinu = 300;//加载等待时间
}
Loading.prototype = {
  // show
  show: function (time) {
    if (!$com.isNull(time)) {
      this.loadingMinu = time
    }
    this.loadingId = layer.load(1, {
      shade: [0.3, '#000'],//0.1透明度背景色
    })
  },
  // hide
  hide: function () {
    const _this = this
    setTimeout(function () {
      layer.close(_this.loadingId);
    }, _this.loadingMinu);
  },
}
export const $loading = new Loading();
window.$loading = $loading;